package cn.wolfcode.MyEnum;

import lombok.Getter;

@Getter
public enum AppointmentEnum {
    PEND("待确认",0),
    PERFORM("履行中",1),
    CONSUME("消费中",2),
    FINISH("归档",3),
    FAILURE("废弃",4);

    private String name ;
    private Integer value;

    AppointmentEnum(String name,Integer value){
        this.name =name;
        this.value =value;
    }
    //提供一个根据value 获取名字的方法
    public static String gainName(Integer value){
        AppointmentEnum[] values = AppointmentEnum.values();
        for (AppointmentEnum a :
                values) {
            if (a.getValue().equals(value)){
                return a.getName();
            }
        }
        return null;
    }

}
